#ifndef DRAWING_H_
#define DRAWING_H_

#include <oslib/oslib.h>
#include "Object.h"
#include "Types.h"
#include "Color.h"

#include <string>
using namespace std;

typedef enum _drawing_type
{
	d_nothing,d_filledrect,d_framedrect,
	d_line,d_image,d_text,d_textbox
}drawing_type;

class Drawing : public Object
{
	protected:
		bool fontwasloaded;
		int x,y,x2,y2;
		int type;
		int PF;
		Color color,bgcolor;
		string textdata;
		OSL_IMAGE *img;
		OSL_FONT *font;
		float fsize;
		unsigned short int foptions;
		bool visible;
		
		void loadImage();
		void drawImage();
		void drawString();
		void drawTextBox();
	public:
		virtual ~Drawing();
		Drawing();
		
		//FilledRect & FramedRect & Line
		Drawing(int _x, int _y, int _x2, int _y2, int _type);
		Drawing(int _x, int _y, int _x2, int _y2, Color c, int _type);
		
		//Textbox & Text & Image
		Drawing(string srctext,int _x, int _y, int _type);
		Drawing(string srctext,int _x, int _y, Color c, int _type);
		Drawing(string srctext,int _x, int _y, Color c, Color bg,int _type);
		
		Drawing(string srctext, int _x, int _y, int _w, int _h, int _type);
		Drawing(string srctext, int _x, int _y, int _w, int _h, Color c, int _type);
		Drawing(string srctext, int _x, int _y, int _w, int _h, Color c, Color bg, int _type);
		
		Drawing(string srctext, int _x, int _y, int _PF, int _type);
		Drawing(string srctext, int _x, int _y, int _w, int _h, int _PF, int _type);
		
		//All
		Drawing(string srctext, int _x, int _y, int _w, int _h, int _PF, Color c, Color bg, int _type);
		
		void redraw();
		
		void setImage(OSL_IMAGE * _img);
		void setFont(OSL_FONT *_font);
		bool setFont(string src);
		void setColor(Color c);
		void setBgColor(Color bg);
		void setText(string text);
		void setSrc(string src);
		void setX(int _x);
		void setY(int _y);
		void moveTo(int _x, int _y);
		void move(int dx, int dy);
		void setStart(int _x1, int _y1);
		void setEnd(int _x2, int _y2);
		void setWidth(int _w);
		void setHeight(int _h);
		void setSize(Size s);
		void setOptions(unsigned short int _foptions);
		void setFontSize(float fsize);
		void hide();
		void show();
		bool toggleVisibility();
		void setVisibility(bool vis);
		
		bool contains(int _x, int _y);
		
		OSL_IMAGE * getImage();
		OSL_FONT * getFont();
		float getFontSize();
		Color getColor();
		Color getBgColor();
		string getText();
		string getSrc();
		int getX();
		int getY();
		Location getLocation();
		int getWidth();
		int getHeight();
		Location getStart();
		Location getEnd();
		Size getSize();
		unsigned short int getOptions();
		bool isVisible();
		bool imageIsLoaded();
		
		void uncache();
};

#endif /*DRAWING_H_*/
